import {
  getTimestamp,
  filterTimeHMS
} from './time'

const Operate = class Operate {
  constructor(props) {
    this.selectType = props.selectType;
    this.operator = props.operator;
    this.number = props.number;
    this.time = props.time;
    this.type = props.type;
  }
  getState() {
    let x = {};
    //类型
    if (this.selectType) {
      x.selectType = this.selectType;
    }
    //时间段
    if (this.time) {
      x.startTime = this.time ? getTimestamp(this.time[0]) : undefined;
      x.endTime = this.time ? getTimestamp(this.time[1]) + 86399999 : undefined;
    }
    //运算符
    if (this.operator) {
      x.operator = this.operator
    }
    //数字
    if (this.number) {
      x.number = this.number
    }
    if (this.type) {
      x.type = this.type
    }

    return x
  }
}

export default Operate
